Skip to content

Conversation

Vinnehboom
Copy link

For any projects built with a ruby version of 3.2.0 or higher, the cap setup command will fail with the following error:

... 
      01 CREATE DATABASE
    ✔ 01 [email protected] 0.604s
00:01 postgresql:generate_database_yml_archetype
      01 mkdir -pv /home/ubuntu/projects/office_hardware_management/staging/db
      01 mkdir: created directory '/home/ubuntu/projects/office_hardware_management/staging/db'
    ✔ 01 [email protected] 0.101s
#<Thread:0x000000010968f7e0 /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: undefined method `exists?' for File:Class (SSHKit::Runner::ExecuteError)
        from /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/capistrano-postgresql-6.2.0/lib/capistrano/postgresql/helper_methods.rb:50:in `pg_template': undefined method `exists?' for File:Class (NoMethodError)

          if File.exists?(config_file) # If there is a customized file in your rails app template directory, use it and convert any ERB
                 ^^^^^^^^
Did you mean?  exist?
        from /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/capistrano-postgresql-6.2.0/lib/capistrano/tasks/postgresql.rake:127:in `block (3 levels) in <top (required)>'
        from /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
        from /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/backends/abstract.rb:31:in `run'
        from /Users/vinnie-bp/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/sshkit-1.21.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: undefined method `exists?' for File:Class


Caused by:
NoMethodError: undefined method `exists?' for File:Class

Tasks: TOP => postgresql:generate_database_yml_archetype

The ruby changelogs refer to the deprecation of the #exists? method.

We can use the alias #exist? (ref)

@tomprats
Copy link

Works for me! Sorry, was thinking I had write access for a second

@NorseGaud
Copy link
Member

@tomprats , I can't help maintain this anymore due to other engagements. I've sent you an invite to have write access.

@tomprats
Copy link

Thank you for your previous work on this, really appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants